package ar.pmt.vista.decoradores;

import org.displaytag.decorator.TableDecorator;

import ar.pmt.vista.beansComplejos.TareaBean;

public class CargaHorasDiariasDecorator extends TableDecorator {

   public String getIncurridoInput() {
	   TareaBean tarea = (TareaBean) getCurrentRowObject();
      return createSelect("incurrido", tarea, tarea.getIncurrido());
   }

   public String getCostoInput() {
	   TareaBean tarea = (TareaBean) getCurrentRowObject();
      return createSelect("costo", tarea, tarea.getCosto());
   }

   private String createSelect(String campo, TareaBean tarea, String valor) {
      String sHtml;
      
      sHtml = "<input class='inputCHDTable' ";
      if ((getListIndex() % 2) == 0) {
         sHtml += "style='background-color: #ebebeb' ";
      }
      sHtml +="id='"+ campo + "_" + tarea.getIdAsignacion()+"' ";
      sHtml += "name='" + campo + "_" + tarea.getIdAsignacion()+"' ";
      sHtml += "value='" + valor +"' ";
      sHtml += "onkeypress='return deshabilitarNoNumericos(event)'/>";
      return sHtml;
   }
}
